package org.xteam.sled.semantic;

import java.util.ArrayList;
import java.util.List;

import org.xteam.parser.runtime.Span;
import org.xteam.sled.model.BasePattern;
import org.xteam.sled.semantic.exp.Exp;


public class ConstructorType implements IDenotable {

	private String name;
	private List<InstructionConstructor> members = new ArrayList<InstructionConstructor>();
	private boolean used;

	public ConstructorType(String name) {
		this.name = name;
	}
	
	public String name() {
		return name;
	}
	
	public List<InstructionConstructor> getMembers() {
		return members;
	}

	@Override
	public Exp projectInt(IEvaluationContext context, Span span) {
		context.reportError(span, "not an integer expression");
		return null;
	}

	@Override
	public BasePattern projectPattern(IEvaluationContext context, Span span) {
		context.reportError(span, "a constructor type is not a pattern, but it could benot a pattern");
		return null;
	}

	public void addMember(InstructionConstructor instructionConstructor) {
		members.add(instructionConstructor);
	}
	
	public String toString() {
		return name;
	}

}
